package com.netty.common;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.commons.lang3.StringUtils;

import io.netty.util.AttributeKey;
import io.netty.channel.Channel;

public class ChatConstants {
    public static final AttributeKey<String> CHANNEL_TOKEN_KEY = AttributeKey.valueOf("netty.channel.token");  
	/**用来保存当前在线人员*/
	public static Map<String, Channel> channels = new ConcurrentHashMap<>();

	/**
	 *
	 * @param token
	 */
	public static void removeOnlines(String token) {
		if(StringUtils.isNotBlank(token)) {
			if( channels.containsKey(token)){
				channels.remove(token);
			}
		}
	}

}
